#pragma once

#include "flexCommCmd.h"
#include <mutex>

class flexCommServer : public flexCommCmd
{
	Q_OBJECT
public:
	flexCommServer(QObject *parent=nullptr);
	~flexCommServer();
public:
	virtual void Init(int port, MSS::CommMode mode)override;
	virtual void SendData(MSS::StFixedData FixedData, QString RegName)override;
	virtual void SendDataProFunc()override;
	virtual void OnRecvData(const StFixedData* Pkt)override;
	virtual void RecvDataProFunc()override;
	virtual void GetRegisteName(char* pData, char* regName, MSS::CommMode& mode)override;

protected:
	std::list<MSS::StFixedData>  mHandleResponseData;//
	std::list<MSS::StFixedData>  mHandleRecvData;
	std::queue<_SendFixedData>   mSendData;
	std::mutex mHandleResponseDataMutex, mHandleRecvDataMutex, mSendDataMutex;
	int mHeartBeatCammandID = (int)CommandID::HeartBeat;
};
